package cn.bjc.feignClient;

import cn.bjc.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFallbackFactory implements FallbackFactory<UserFeignClient> {
    
    @Override
    public UserFeignClient create(Throwable throwable) {
        
        return new UserFeignClient() {
            @Override
            public User getById(Long id) {
                return new User(-1L, "熔断了", "被熔断了");
            }
        };
    }
}
